<template>
  <div class="ChatContent1">
    <img :src="backImage" alt="" />
    <div class="chatContentContent">
      <div v-for="msg in messages" :key="msg.id" class="animate-fadeIn">
        <MessageItem :message="msg" />
      </div>
    </div>
    <!-- <ChatInput @send="handleSendMessage" /> -->
  </div>
</template>

<script setup lang="ts">
  import { defineProps, emit } from 'vue';
  import { Message } from '../types/chat';
  import MessageItem from './MessageItem.vue';
  import ChatInput from './ChatInput.vue';
  import backImage from '../ui/image.png';
  const props = defineProps<{
    messages: Message[];
  }>();

  const emit = defineEmits<{
    (e: 'sendMessage', content: string): void;
  }>();

  const handleSendMessage = (content: string) => {
    emit('sendMessage', content);
  };
</script>

<style lang="less" scoped>
  .ChatContent1 {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    img {
      position: absolute;
      top: 50%;
      /* 距离顶部50% */
      left: 50%;
      /* 距离左侧50% */
      transform: translate(-50%, -50%);
    }
    .chatContentContent {
      width: 100%;
      height: 85%;
      z-index: 998;
      .animate-fadeIn {
        width: 100%;
      }
    }
  }
</style>
